package com.yyplatform.admin.platform.monitor.controller;

import static com.yyplatform.admin.Constants.URL_PREFIX;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yyplatform.admin.infra.model.RestResponse;
import com.yyplatform.admin.platform.monitor.model.ServerMonitorDTO;
import com.yyplatform.admin.platform.monitor.service.ServerMonitorService;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * Created on 2025-04-17
 */
@Slf4j
@Tag(name = "监控/服务器监控")
@AllArgsConstructor
@RestController
@RequestMapping(URL_PREFIX + "/monitor/server/")
public class ServerMonitorController {

    @Autowired
    private ServerMonitorService serverMonitorService;

    @GetMapping("get")
    @Operation(summary = "查询")
    @RequiresPermissions("sys:serverMonitor:query")
    public RestResponse<ServerMonitorDTO> get() {
        log.info("get server monitor info...");

        ServerMonitorDTO data = serverMonitorService.getServerMonitor();
        return RestResponse.ok(data);
    }


}
